--[[
Switcheroo

version: 0.1
author: Tabithy
email: tabithy@gmail.com
website: http://www.googlecode.com/p/tabstools
]]

Switcheroo =  CreateFrame("frame")

Switcheroo:SetScript("OnEvent", 
		function (self, event, ...) 
			if self[event] then 
				return self[event](self, event, ...) 
			end 
		end)

Switcheroo:RegisterEvent("ADDON_LOADED")

function Switcheroo:Print(...)
	ChatFrame1:AddMessage(string.join(" ", "|cFFF29A3ESwitcheroo|r:", ...))
end


function Switcheroo:ADDON_LOADED(event, addon)
	if addon ~= "Switcheroo" then return end
	self:UnregisterEvent("ADDON_LOADED")
	self.ADDON_LOADED = nil
	if IsLoggedIn() then self:PLAYER_LOGIN() else self:RegisterEvent("PLAYER_LOGIN") end
end


function Switcheroo:PLAYER_LOGIN()
	self:Print("hello from Switcheroo!")
	self:RegisterEvent("ZONE_CHANGED")
	self:UnregisterEvent("PLAYER_LOGIN")
end


function Switcheroo:ZONE_CHANGED()
	self:Print(GetSubZoneText() or GetZoneText())
end


function Switcheroo:Edit(name, substring)
	local macroid = GetMacroIndexByName(name)
	if not macroid then return end
	EditMacro(macroid, name, 1, body)
end



